﻿<Window x:Class="WpfUseLayoutRounding.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
     
    <StackPanel Width="150"  Margin="7" Orientation="Horizontal">
        <!-- Single pixel line with layout rounding turned OFF.-->
        <Rectangle UseLayoutRounding="False"
         Width="45.5" Margin="10" Height="1" Fill="Red"/>
        <!-- Single pixel line with layout rounding turned ON.-->
        <Rectangle UseLayoutRounding="True"
        Width="45.5" Margin="10" Height="1" Fill="Red"/>
    </StackPanel>
    <!-- Background Grid -->
    <Window.Background>
        <DrawingBrush  Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">
            <DrawingBrush.Drawing>
                <DrawingGroup>
                    <GeometryDrawing Brush="White">
                        <GeometryDrawing.Geometry>
                            <RectangleGeometry Rect="0,0,1,1" />
                        </GeometryDrawing.Geometry>
                    </GeometryDrawing>
                    <GeometryDrawing Geometry="M0,0 L1,0 1,0.1, 0,0.1Z " Brush="#CCCCFF" />
                    <GeometryDrawing Geometry="M0,0 L0,1 0.1,1, 0.1,0Z" Brush="#CCCCFF" />
                </DrawingGroup>
            </DrawingBrush.Drawing>
        </DrawingBrush>
    </Window.Background>
</Window>
